package com.joinlabs.entity;

public class PageBean {

	private int curPage;	//当前页
	private int totalPage;	//总页数
	private int totalCount;	//总数量
	private int startIndex;	//当前页开始下标
	private int endIndex;	//当前页结束下标
	private int pageCount;	//一页显示的数量
	public PageBean() {
		super();
	}
	public PageBean(int curPage, int totalPage, int totalCount, int startIndex,
			int endIndex, int pageCount) {
		super();
		this.curPage = curPage;
		this.totalPage = totalPage;
		this.totalCount = totalCount;
		this.startIndex = startIndex;
		this.endIndex = endIndex;
		this.pageCount = pageCount;
	}
	public int getCurPage() {
		return curPage;
	}
	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	public int getStartIndex() {
		return startIndex;
	}
	public void setStartIndex(int startIndex) {
		this.startIndex = startIndex;
	}
	public int getEndIndex() {
		return endIndex;
	}
	public void setEndIndex(int endIndex) {
		this.endIndex = endIndex;
	}
	public int getPageCount() {
		return pageCount;
	}
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}
	@Override
	public String toString() {
		return "PageBean [curPage=" + curPage + ", totalPage=" + totalPage
				+ ", totalCount=" + totalCount + ", startIndex=" + startIndex
				+ ", endIndex=" + endIndex + ", pageCount=" + pageCount + "]";
	}
	
	//计算下标
	public void calcIndex() {
		
		startIndex = (curPage-1)*pageCount;	//(当前页-1)*一页数量 	
		endIndex = startIndex+pageCount;	//开始下标+一页数量
	}
	
	//设置总数量，计算总页数
	public void calcPages(int totalCount) {
		
		this.totalCount = totalCount;
		
		//总页数
		this.totalPage = (totalCount%pageCount == 0)?totalCount/pageCount:totalCount/pageCount+1;
		
	}
	
	
	
}
